﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace TP2
{
    public partial class HystoryTranslationForm : Form
    {
        int id_client;
        //int id_recipient;
        public HystoryTranslationForm(int idClient)
        {
            id_client = idClient;
            //id_recipient = idRecipient;
            InitializeComponent();
        }

        private void buttonClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void HystoryTranslationForm_Load(object sender, EventArgs e)
        {
            DBWorkClass dbWork = new DBWorkClass();
            LegalClientTypeClass clientSender = new LegalClientTypeClass();
            LegalClientTypeClass clientRecipient = new LegalClientTypeClass();
            HistoryTypeClass typeHistory = new HistoryTypeClass();
            typeHistory = dbWork.SelectFromHistory(id_client);
            
            if (typeHistory.id_translation.Count == 0)
            {
                dataGridView1.RowCount = 1;
                dataGridView1[0, 0].Value = "";
                dataGridView1[1, 0].Value = "";
                dataGridView1[2, 0].Value = "";
                dataGridView1[3, 0].Value = "";
            }
            else { dataGridView1.RowCount = typeHistory.id_translation.Count; }
            int j = 0;
            while (j < typeHistory.id_translation.Count)
            {
                dataGridView1[0, j].Value = typeHistory.date[j].ToString();
                dataGridView1[1, j].Value = typeHistory.sender_title[j].ToString();
                dataGridView1[2, j].Value = typeHistory.sender_inn[j].ToString();
                dataGridView1[3, j].Value = typeHistory.recipient_title[j].ToString();
                dataGridView1[4, j].Value = typeHistory.recipient_inn[j].ToString();
                dataGridView1[5, j].Value = typeHistory.deposit[j].ToString();
                j++;
            }           
        }

        
    }
}
